﻿using System;
using Framework;

namespace Enterprise.Admin.Handle
{
    /// <summary>
    /// 添加文章分类
    /// </summary>
    public partial class AddArticleCategory : AdminBasePage
    {
        protected void Page_Load(object sender, EventArgs e)
        {
            object result;
            try
            {
                var name = Fq("CoName");
                var nameEn = Fq("CoNameEn");
                var sorts = Fq("CoSort").SafeToInt();
                var parentId = Fq("CoParentId").SafeToInt();
                var articleCategoryService = new ArticleCategoryService();
                articleCategoryService.Add(name, nameEn, parentId, sorts);
                result = new { state = true, message = "添加成功" };
            }
            catch (Exception ex)
            {
                result = new { state = false, message = ex.Message };
            }
            Json(result);

        }
    }
}